cmake_minimum_required(VERSION 3.10)
project(intro_cuda LANGUAGES CXX CUDA)

# Set C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find all .cu and .cpp files in this directory
file(GLOB SOURCES "*.cu" "*.cpp")

# Add executable for each source file
foreach(SRC ${SOURCES})
    get_filename_component(EXE_NAME ${SRC} NAME_WE)
    add_executable(${EXE_NAME} ${SRC})
    set_target_properties(${EXE_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
    target_compile_features(${EXE_NAME} PRIVATE cxx_std_14)
endforeach()
